package C10_8_ReplaceParameterWithMethods;

/**
 * 以函数取代参数
 **/
public class ReplaceParameterWithMethods {

    void test() {
        int num = 5 + 5;
        String phoneNum = getPhoneNum();
        printMsg(num,phoneNum);
    }

    String getPhoneNum() {
        return "555223155324";
    }

    void printMsg(int num, String phoneNum) {
        if (num > 6) {
            System.out.println(phoneNum);
        }
    }

    void refactor() {
        int num = 5 + 5;
        printMsg(num);
    }

    void printMsg(int num) {
        String phoneNum = getPhoneNum();
        if (num > 6) {
            System.out.println(phoneNum);
        }
    }
}
